package com.community.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.community.dao.RightDao;
import com.community.dao.RoleDao;
import com.community.entity.Right;
import com.community.entity.Role;
import com.community.service.RoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Role)表服务实现类
 *
 * @author makejava
 * @since 2021-11-01 08:01:21
 */
@Service("roleService")
public class RoleServiceImpl extends ServiceImpl<RoleDao, Role> implements RoleService {
    @Resource
    RoleDao roleDao;
    @Resource
    RightDao rightDao;

    //获取用户-->角色-->权限
    public List<Right> findRightsByRole(Role role) {
        return roleDao.findRightsByRolesOrderByRightCode(role);
    }

    //获取所有权限
    public List<Right> findAllRights() {    //用自带dao层的报错傻逼玩意
        return rightDao.findAllRights();
    }
}

